** Replication Code for:
** Terrorism Activates Ethnocentrism to Explain Greater Willingness to 
** Sacrifice Civil Liberties: Evidence from Germany
** Authors: Christina Novak Hansen and Peter Thisted Dinesen 
** Date: 10/02/2021

*-------------------------------------------------------------------------------

clear all
use GGSS2016_analysis.dta
svyset xs11 [pweight=wghtpew], vce(linearized)


*-------------------------------------------------------------------------------
*Appendix K: Addressing selection: Comparability of treatment and control groups
*-------------------------------------------------------------------------------
								
								
								****Table K1***

*Sociodemographic difference between the pre- and post-attacks groups
*Results have den manually transferred to word table.

tab sex treatment1 if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, column
svy: mean age if treatment1==0 & st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1
estat sd
svy: mean age if treatment1==1 & st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1
estat sd
tab proedu2 treatment1 if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, column
tab work2 treatment1 if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, column

prtest sex if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, by(treatment1)		
ttest age if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, by(treatment1)	
prtest low_second if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, by(treatment1)
prtest upp_second if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, by(treatment1)
prtest short_tert if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, by(treatment1)
prtest medlong_tert if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, by(treatment1)

prtest unemployed if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, by(treatment1)
prtest working if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, by(treatment1)
prtest retired if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, by(treatment1)
prtest housework if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, by(treatment1)
prtest student if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1, by(treatment1)


********************************************************************************

				***Described but not displayed in online appendix***


*Men
svy: regress st_terrori c.st_ethno##i.treatment1 st_age st_age2 i.proedu2 i.work2 if sex==0
outreg2 using results.xls, drop(st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label(proper) replace
*Women
svy: regress st_terrori c.st_ethno##i.treatment1 st_age st_age2 i.proedu2 i.work2 if sex==1
outreg2 using results.xls, drop(st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label(proper) append

*Education
*Less than medium to long tertiary
svy: regress st_terrori c.st_ethno##i.treatment1 i.sex st_age st_age2 i.proedu2 i.work2 if proedu2<=3
outreg2 using results.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label(proper) replace
*Medium to long tertiary
svy: regress st_terrori c.st_ethno##i.treatment1 i.sex st_age st_age2 i.proedu2 i.work2 if proedu2==4
outreg2 using results.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label(proper) append

*Working
*Non-working
svy: regress st_terrori c.st_ethno##i.treatment1 i.sex st_age st_age2 i.proedu2 i.work2 if work2!=2
outreg2 using results.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label(proper) replace

*Working
svy: regress st_terrori c.st_ethno##i.treatment1 i.sex st_age st_age2 i.proedu2 i.work2 if work2==2
outreg2 using results.xls, drop(i.sex st_age st_age2 i.proedu2 i.work2) nocons stats(coef se) dec(2) symbol(**,*) alpha(0.01,0.05) label(proper) append

*-------------------------------------------------------------------------------
